package com.tuozixuan.camel.timer;

import java.util.Date;

import org.apache.camel.Exchange;
import org.springframework.stereotype.Component;

@Component
public class CustomTimerProcessor {

    public String saySomething(Exchange exchange) {
        
        String timerName = exchange.getProperty(Exchange.TIMER_NAME, String.class);
        Date timerFiredTime = exchange.getProperty(Exchange.TIMER_FIRED_TIME, Date.class);
        Long timerPeriod = exchange.getProperty(Exchange.TIMER_PERIOD, Long.class);
        Long count = exchange.getProperty(Exchange.TIMER_COUNTER, Long.class);
        String timerInfo = String.format("timerName:%s timerPeriod:%d count:%d timerFiredTime:%s", timerName, timerPeriod, count, timerFiredTime);
        
        return "timer is fired. " + timerInfo;
    }

}
